<template>
    <div class="app-container">
        <el-card shadow="never">
            <!-- 条件查询 -->
            <el-form v-show="showSearch" ref="queryForm" :model="queryParams" label-width="120px" @keyup.enter.native="submitSearch" @submit.native.prevent>
                <el-row>
                    <!-- <el-col :md="6" :sm="12">
                        <el-form-item label="id:" prop="id.value">
                            <el-input v-model="queryParams.id.value" placeholder="请输入id" clearable />
                        </el-form-item>
                    </el-col> -->
                    <el-col :md="6" :sm="12">
                        <el-form-item label="批次号:" prop="batch.value">
                            <el-input v-model="queryParams.batch.value" placeholder="请输入批次号" clearable />
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :md="6" :sm="12">
                        <el-form-item label="申请人:" prop="admin_id.value">
                            <el-input v-model="queryParams.admin_id.value" placeholder="请输入申请人" clearable />
                        </el-form-item>
                    </el-col> -->
                    <el-col :md="6" :sm="12">
                        <el-form-item label="内衣编号:" prop="brand.value">
                            <el-input v-model="queryParams.brand.value" placeholder="请输入内衣编号" clearable />
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :md="6" :sm="12">
                        <el-form-item label="审核状态:" prop="status.value">
                            <el-select v-model="queryParams.status.value" placeholder="审核状态" clearable>
                                <el-option v-for="(item, index) in status" :key="index" :label="item.label" :value="item.value" />
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                    <!-- <el-col :md="6" :sm="12">
                        <el-form-item label="申请时间:" prop="apply_time.value">
                            <el-date-picker
                                v-model="queryParams.apply_time.value"
                                type="datetimerange"
                                range-separator="至"
                                start-placeholder="开始"
                                end-placeholder="结束"
                                align="right"
                                value-format="yyyy-MM-dd HH:mm:ss"
                            >
                            </el-date-picker>
                        </el-form-item>
                    </el-col> -->

                    <el-col :md="6" :sm="12">
                        <el-form-item class="ele-text-right" label-width="50px">
                            <el-button type="primary" size="mini" @click="submitSearch" icon="el-icon-search" class="ele-btn-icon">搜索 </el-button>
                            <el-button @click="resetQuery" size="mini" icon="el-icon-refresh">重置</el-button>

                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>

            <!-- 列表 -->
            <qa-table
                :source="tableData"
                :columns="columns"
                :selection="true"
                :loading="loading"
                @sortChange="sortChange"
                @statusChange="statusChange"
                @selectionChange="selectionChange"
                id="quickadmin"
            >
                <template v-slot:action>
                    <el-table-column label="操作" width="240" align="left">
                        <template slot-scope="scope">
                            <el-button class="btn-mar" size="mini" type="primary" icon="el-icon-edit" @click="handleEdit(scope.row)" v-hasPermi="api.edit">审核</el-button>
                            <!-- <el-button class="btn-mar" size="mini" type="info" icon="el-icon-tickets" @click="handleDetail(scope.row)" v-hasPermi="api.find">详情</el-button> -->
                            <!-- <el-button class="btn-mar" size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="api.delete">删除</el-button> -->
                        </template>
                    </el-table-column>
                </template>
            </qa-table>

            <!-- 分页 -->
            <pagination :total="total" :page.sync="pageInfo.page" :limit.sync="pageInfo.limit" @pagination="initIndex" />
        </el-card>

        <!-- 编辑弹窗 -->
        <el-dialog :title="!disabled ? '编辑' : '详情'" :visible="editOpen"  :before-close="beforeClose" destroy-on-close>
            <EditForm ref="editForm" :findFormData="findFormData"  :disabled="disabled" @submitForm="submitForm" :editFormParams="editFormParams" @editFormCancel="beforeClose" />
        </el-dialog>

    </div>
</template>

<script>
import { curdMixin } from '@/mixins/curdMixin'
import EditForm from './EditFormCom'
export default {
    name: 'Curd',
    mixins: [curdMixin],
    components: { EditForm },
    
    data() {
        return {
            // table结构
            columns: [
                // {
                //     visible: true,
                //     label: 'id',
                //     prop: 'id',
                // },
                {
                    visible: true,
                    label: '批次号',
                    prop: 'batch',
                },
                {
                    visible: true,
                    label: '申请人',
                    prop: 'admin_title',
                },
                {
                    visible: true,
                    label: '内衣编号',
                    prop: 'brand',
                },
                {
                    visible: true,
                    label: '补货数量',
                    prop: 'rep_num',
                },
                {
                    visible: true,
                    label: '审核状态',
                    prop: 'status_title',
                },
                {
                    visible: true,
                    label: '备注',
                    prop: 'content',
                },
                {
                    visible: true,
                    label: '申请时间',
                    prop: 'apply_time',
                },

            ],
            // 接口地址
            api: {
                index: `/admin/check/index`,
                find: `/admin/check/find`,
                add: `/admin/check/add`,
                edit: `/admin/check/edit`,
                delete: `/admin/check/delete`,
                export: `/admin/check/export`,
                status: `/admin/check/status`
            },
            editFormParams: {
            },
            pageInfo: {
                sort: 'id',
            },
            primaryKey: 'id',
            // 搜索表单是否展开
            searchExpand: false,
              //是否展示搜索
            showSearch: true,
            // 查询参数
            queryParams: {
                id: { value:undefined, op: '='},
                batch: { value:undefined, op: '%like%'},
                admin_id: { value:undefined, op: '='},
                brand: { value:undefined, op: '%like%'},
                status: { value:undefined, op: '='},
                apply_time: { value:[], op: 'range'},

            },
            status:[
            ],

        }
    },
    created () {
        this.initIndex()
    },
    watch: {
        
    },
    methods: {
        // 案列：当前组件格式化方法
        testFormatter(prop) {
            return prop
        },
        
    }
}
</script>
<style lang="scss">
.btn-mar {
    margin: 5px !important;
}
</style>
